/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/database/SPContacts.cpp,v 1.5 2003/11/21 12:39:24 itsme Exp $
 *
 *
 * this file handles the CryptoPhone contacts database
 *
 * this is not yet used.
 *
 */
#include "debug.h"
#include "SPContacts.h"



WCHAR *SPContacts::DatabaseName()
{
    return L"spcontacts.db";
}

SPContacts::SPContacts()
{
}

SPContacts::~SPContacts()
{
}

void SPContacts::Open()
{
    if (!m_db.Open(DatabaseName()))
    {
        m_db.Create(DatabaseName());
        m_db.Open(DatabaseName());
    }
}


bool SPContacts::AddEntry(const SPContactsEntry &entry)
{
    CeRecord rec(3);
    rec.AddUInt32(DBSPCONTACTS_SYSOID_FIELD, entry.sysoid);
    rec.AddString(DBSPCONTACTS_NUMBER_FIELD, entry.number[0].c_str());
    rec.AddString(DBSPCONTACTS_PUBLICKEY_FIELD, entry.publicKey.c_str());
    return m_db.CommitRecord(rec);
}
